﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using NPSoft.Ferrero.Framework.Web;
using NPSoft.Ferrero.Framework.AOP;
using NPSoft.Ferrero.Framework.Crosscutting;
using NPSoft.Ferrero.DataBridge.Model;
using NPSoft.Ferrero.DataBridge.BLL;
using NPSoft.Ferrero.Framework.BLL;
using NPSoft.Ferrero.DataBridge.Web.Services;

namespace NPSoft.Ferrero.DataBridge.Web
{
    public class WebConfig : IWebConfig
    {

        public void ConfigureSystem()
        {
            // 创建容器  
            INPContainer container = this.Container;
            NPWebApp.SetContainer(container);
            // 设置接口拦截，配置拦截器
            NPWebApp.Container.SetDefaultInterceptorFor<IBLL<Store>, StoreService, UserLogBehavior>();
            NPWebApp.Container.SetDefaultInterceptorFor<IBLL<Banner>, BannerService, UserLogBehavior>();
            NPWebApp.Container.SetDefaultInterceptorFor<IBLL<Distributor>, DistributorService, UserLogBehavior>();
            NPWebApp.Container.SetDefaultInterceptorFor<IBLL<Geography>, GeographyService, UserLogBehavior>();
            NPWebApp.Container.SetDefaultInterceptorFor<IBLL<HumanResource>, HumanResourceService, UserLogBehavior>();
            NPWebApp.Container.SetDefaultInterceptorFor<IBLL<Product>, ProductService, UserLogBehavior>();
            NPWebApp.Container.SetDefaultInterceptorFor<IBLL<ProductRTPrice>, ProductRTPriceService, UserLogBehavior>();
            NPWebApp.Container.SetDefaultInterceptorFor<IBLL<ProductUOM>, ProductUOMService, UserLogBehavior>();
            NPWebApp.Container.SetDefaultInterceptorFor<IBLL<ProductCTPrice>, ProductCTPriceService, UserLogBehavior>();
            NPWebApp.Container.SetDefaultInterceptorFor<IBLL<Ex_F>, Ex_FService, UserLogBehavior>();
            NPWebApp.Container.SetDefaultInterceptorFor<IBLL<New_Mapped_Store>, New_Mapped_StoreService, UserLogBehavior>();

            // 邮件日志
            NPWebApp.Container.SetDefaultInterceptorFor<IFCR_IN_MailServices, FCR_IN_MailServices, UserLogBehavior>();
        }

        public INPContainer Container
        {
            get
            {
                NPContainerFactory factory = new NPContainerFactory();
                INPContainer container = factory.Create();
                return container;
            }
        }
    }
}